let utils = {
    setAdaption: function (baseFontsize) {
        baseFontsize = baseFontsize || 7.5;
        var docEl = document.documentElement;
        var refresh = function () {
            var dpr = window.devicePixelRatio,
                deviceWidth = docEl.getBoundingClientRect().width,
                deviceFontsize = deviceWidth / baseFontsize + "px";
            docEl.setAttribute('data-dpr', dpr);
            docEl.style.fontSize = deviceFontsize;
        };

        window.addEventListener('pageshow', function (e) {
            if (!e.pretersised) {
                refresh();
            }
        }, false);
        window.addEventListener('resize', function () {
            refresh();
        }, false);
    }
};

export default utils;
